package com.ssh.web;
import com.opensymphony.xwork2.ActionSupport;
import com.ssh.ser.UserService;

/**
 * @author jun
 * LoginAction 登录控制层
 */
public class LoginAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private String password;
	private UserService userService;

	public String login() {
		/* NAME和PASSWORD为空则返回登录页面，否则验证登录 */
		if (null == name && null == password) {
			return "login";
		} else {
			Boolean u = userService.login(name, password);
			if (u) {
				return "ok";
			} else {
				return "error";
			}
		}
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
}